package com.example.heipictureserver.api.imagesearch;

import com.example.heipictureserver.api.imagesearch.modal.ImageSearchResult;
import com.example.heipictureserver.api.imagesearch.sub.GetImageFirstUrlApi;
import com.example.heipictureserver.api.imagesearch.sub.GetImageListApi;
import com.example.heipictureserver.api.imagesearch.sub.GetImagePageUrlApi;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/*
 *@Description 类功能简要描述
 *@Author bwg
 *@Date 2025/2/1 15:08
 */
@Slf4j
public class ImageSearchApiFacade {

    /**
     * 搜索图片
     * @param imageUrl
     * @return
     */
    public static List<ImageSearchResult> searchImage(String imageUrl) {
        String imagePageUrl = GetImagePageUrlApi.getImagePageUrl(imageUrl);
        String imageFirstUrl = GetImageFirstUrlApi.getImageFirstUrl(imagePageUrl);
        List<ImageSearchResult> imageList = GetImageListApi.getImageList(imageFirstUrl);
        return imageList;
    }

    public static void main(String[] args) {
        List<ImageSearchResult> imageList = searchImage("https://hei-picture-1336629613.cos.ap-beijing.myqcloud.com/public/2894e96a4555dfa341e59ec686903a82/2025-02-01_dHuBkk6y0WLrJ1h3.webp");
        System.out.println("结果列表" + imageList);
    }
}
